package com.study.rabbitmq;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;

import java.io.UnsupportedEncodingException;


@Component
public class MessageListener {

    @RabbitListener(queues = "queue.anno")
    public void whenMessageCom(Message message) throws UnsupportedEncodingException {
        System.out.println(new String(message.getBody(),message.getMessageProperties().getContentEncoding()));

    }

    /*@RabbitListener(queues = "queue.anno")
    public void messageShow(@Payload Message messageStr){

        System.out.println(messageStr);
    }*/
}
